package com.kingwood.algorithm.zuochengyun.digui;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

/**
 * @Author 22025812
 * @Description: TODO
 * @Date: 2024/3/8 14:19
 * @Modified By：
 * @Version 1.0
 */
public class Subsequences {
    public static String[] generatePermutation1(String str) {
        char[] chars = str.toCharArray();
        HashSet<String> set = new HashSet<>();
        f1(chars, 0, new StringBuilder(), set);
        int m = set.size();
        String[] ans = new String[m];
        int i = 0;
        for (String s : set) {
            ans[i++] = s;
        }
        return ans;
    }

    public static void f1(char[] chars, int i, StringBuilder path, HashSet<String> set) {
        if (i == chars.length) {
            set.add(path.toString());
        } else {
            path.append(chars[i]);
            f1(chars, i + 1, path, set);
            path.deleteCharAt(path.length() - 1);
            f1(chars, i + 1, path, set);
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();

        String[] res = generatePermutation1(str);
        System.out.println(Arrays.toString(res));
    }
}
